import 'lib-flexible'
import routeArr from '@/routes'

export function patchRoutes({ routes }) {

  routeArr.forEach((item)=>{
    if(item.path==='/home'){
      routes[0].routes.unshift({
        exact:true,
        path: '/',
        title:'home',
        component: require('@/pages'+item.path).default,
      });
    }else{
      routes[0].routes.unshift({
        ...item,
        component: require('@/pages'+item.path).default,
      });
      item.routes.forEach((child: any)=>{
        routes[0].routes.unshift({
          exact: true,
          ...child,
          component: require('@/pages'+child.path).default,
        });
      })
    }
  })
}
